﻿<%@ Page Title="" Language="C#" MasterPageFile="my-account.master" AutoEventWireup="true"
    CodeBehind="new-blog-post.aspx.cs" Inherits="SocialShare.Web.My_Account.new_blog_post" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   <script type="text/javascript" src="../Scripts/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="../Scripts/ckeditor/adapters/jquery.js"></script>
    <script type="text/javascript" src="../Scripts/maxlength/jquery.maxlength.js"></script>
    
    <script type="text/javascript">
        
        $(document).ready(function () {
            $('#ckeditor').ckeditor();
            $('#ckeditor').val($("#<%= hidCKEDitorValue.ClientID %>").val());
            $('#<%= textareaSummary.ClientID %>').maxlength({ slider: true, maxCharacters: 500 });
            $("#<%= textareaSummary.ClientID %>").maxlength({
                events: ['blur'],
                maxCharacters: 500,
                status: true,
                statusClass: "status",
                statusText: "character left",
                notificationClass: "notification",
                showAlert: false,
                slider: true
            });

            $('.autoclear').autoclear();
        });
        function GetCKEditorData() {
            var data = $('#ckeditor').val();
            if (data != "") {
                $("#<%= hidCKEDitorValue.ClientID %>").val(data);
                return true;
            }
            else {
                alert("Empty post is not allowed.");
                return false;
            }

        }
        
    </script>
    <script src="../Scripts/jquery.autoclear.js" type="text/javascript"></script>
 <asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="valgrpNewBlog" ShowMessageBox="true" ShowSummary="false" HeaderText="You have missed the followings:" />
        <section id="divMessage" runat="server" visible="false">
        <asp:Literal ID="lblMessage" runat="server"></asp:Literal>
    </section>
    
    <section class="title-regular">
        New Blog Post</section>
    <hr />
   
    <p>
         <asp:TextBox ID="txtTitle" runat="server" CssClass="text autoclear grid-5-manual"
            Text="Title"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvtxtTitle" runat="server" ErrorMessage="Post title" InitialValue="Title" ControlToValidate="txtTitle" ValidationGroup="valgrpNewBlog"
            SetFocusOnError="true" Display="None"></asp:RequiredFieldValidator>
            <br />
         <textarea name="textareaSummary" id="textareaSummary" runat="server" class="summary-textarea text autoclear" title="Post Summary" rows="50" cols="113"></textarea>
         <asp:RequiredFieldValidator ID="rfvtextareaSummary" runat="server" ErrorMessage="Post summary" ControlToValidate="textareaSummary" ValidationGroup="valgrpNewBlog" InitialValue="Post Summary"
            SetFocusOnError="true" Display="None"></asp:RequiredFieldValidator>
        <br />
        <textarea name="editor1" id="ckeditor" class="autoclear"></textarea>
        <input id="hidCKEDitorValue" type="hidden" runat="server" />
        <br />
        Allow Comments on this post: <asp:CheckBox ID="chkAllowComments" runat="server" />
    </p>
    <br />
    <asp:LinkButton ID="lnbAddNew" runat="server" CssClass="button medium blue" CausesValidation="true" ValidationGroup="valgrpNewBlog" OnClick="lnbAddNew_Click">Submit</asp:LinkButton>
    <asp:LinkButton ID="lnbCancel" runat="server" CssClass="button medium gray" PostBackUrl="default.aspx" CausesValidation="false">Cancel</asp:LinkButton>
</asp:Content>
